﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace sentence
{
    class SentenceUtility
    {
        public static string HomePageUrl = "http://sentence.cc-lab.tk/";
        public static string ImageServerUrl = "";
        public static string ProjectPageUrl = "";
        public static string Version;
        public static string ApplicationDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
        public static string WorkingDirectory = getWorkingDirectory();
        public static string WallPaperDate = "20120101";
        public static string DownloadURL = "http://sentence.sinaapp.com/download.php";
        private static string getWorkingDirectory()
        {
            string path = Path.GetTempPath()+"Sentence\\";
            if(!Directory.Exists(path)){
                Directory.CreateDirectory(path);   
            }
            return path;
        }
        public enum ScreenRatio { SixteenByTen, SixteenByNine, FourByThree, NO_MATCH }
        public static ScreenRatio MainScreenRatio = GetScreenRatio();
        public static ScreenRatio GetScreenRatio()
        {
            int width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
            int height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
            double screen_ratio = (double)width / height;
            if (screen_ratio == 1.6)
            {
                return ScreenRatio.SixteenByTen;
            }
            else if (screen_ratio * (3.0 / 4) == 1 || screen_ratio * (4.0 / 5) == 1)
            {
                return ScreenRatio.FourByThree;
            }
            else if (screen_ratio > 1.77 && screen_ratio < 1.78)
            {
                return ScreenRatio.SixteenByNine;
            }
            else
            {
                return ScreenRatio.NO_MATCH;
            }
        }
    }
}
